<?php

/*
 * return demo
 * 
 * 
 * @author   ken(695093513@qq.com)
 * @copyright (c) 2015-08, pingan
 * 
 */
header("Content-Type: text/html;charset=utf-8");

$orig = $_POST['orig'];
$sign = $_POST['sign'];


$tTrustPayCertFile = 'merchant/paygate.cer';

require_once 'lib/pingan.php';
$pingan = new pingan();

//1、进行数据转码
$orig = $pingan->_base64_url_decode($orig);
$sign = $pingan->_base64_url_decode($sign);

//2、验证签名是否正确
$result = $pingan->validate($orig, $sign, $tTrustPayCertFile);
if ($result) {
    echo 'success';
} else {
    exit('error');
}

//3、将xml数据转换成array
$orig_data = $pingan->xml_to_array($orig);

print_r($orig_data);